before using them in the program. Some of the variable types are
Integers, fixed number, Boolean, byte, enum, address, array, struct,
and string.
However, all these data types can be again divided into two types,
which are as follows:
Value type
Reference type
Please note that even if Solidity is partly designed after ECMAScript,
its syntaxes are pretty much similar to JavaScript. However, the
concept of the “undefined” or “null” values does not exist in Solidity,
but the declared variables, even if not explicitly initialized, always
have a default value dependent on its type.
2.5.10.1 Value Type
The value type variables are those that are passed by value after
being copied independently for wherever they are used and not by
their reference in some real location where they are stored. Now,
let’s explore the types that fall under the value type.
2.5.10.1.1 Integers
Integers in Solidity can be either of signed (i.e., int) or unsigned (i.e.,
uint) type. I hope we all know the difference between signed and
unsigned. The unsigned integers are 0 and positive numbers,
whereas the signed integer can be negative, 0, and positive integers.
By default, the size of the integer in Solidity is 256 bits, which can
also be represented as int256 for the signed and uint256 bits for the
unsigned integer. We can have other sizes as int8/uint8, int16/uint16,
int32/uint32 up to int256/uint256. Please refer to the maximum and
minimum allowed values in each of these integer types while using
them in the program.
2.5.10.1.2 Fixed Numbers
A number can be of a constant or a fixed value by using a fixed
keyword in its front.